package com.yanqu.road.server.manger.config.grandchild.skill.condition;

import com.yanqu.road.entity.grandchild.GrandChildData;
import com.yanqu.road.server.manger.config.grandchild.skill.param.GrandChildSkillConditionParam;

import java.util.ArrayList;

public class SkillConditionTOM {

    public static boolean canRandom(GrandChildData data, GrandChildSkillConditionParam param) {
        ArrayList<Integer> list = new ArrayList<>(data.getFlairList());
        if (list.isEmpty()) {
            return false;
        }
        int value1 = list.stream().mapToInt(Integer::intValue).max().getAsInt();
        for (int i = 0; i < list.size(); i++) {
            if (list.get(i) == value1 && (i+1 == param.getValue()) ) {
                return true;
            }
        }
        return false;
    }

}
